<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%
    String basePath = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Merchandise Excel</title>
<style type="text/css">
</style>

	<script type="text/javascript" src="http://static.yunyike.com/static/js/zepto.min.js"></script>
</head>
<body>
	</br>
	<div>

		<span><a href="<%=basePath%>/merchandise/exportexcel"><span><button>导出EXCEL</button></span>
		</a></span>
	</div>
	</br>
	<form id="fileUpload" action="<%=basePath%>/merchandise/importexcel"
		encType="multipart/form-data" method="post">
		<input id="excelFile" name="excelFile" type="file" /> <input
			type="button" value="提交" onclick="submitExcel()" />
	</form>
	</br>
	<div>
		<span style="color: red">${message}</span>
	</div>
	</br>
	<div style="color: blue">
		<c:if test="${errorList!=null}">
			<c:forEach var="err" items="${errorList}" varStatus="error">
			${err}
		</c:forEach>
		</c:if>
	</div>
	<div>
		<span style="color: red">${errorMsg}</span>
	</div>
	<script type="text/javascript">
		function submitExcel() {
			var excelFile = $("#excelFile").val();
			if (excelFile == '') {
				alert("请选择需上传的文件!");
				return false;
			}
			if (excelFile.indexOf('.xls') == -1) {
				alert("文件格式不正确，请选择正确的Excel文件(后缀名.xls)！");
				return false;
			}
			if (confirm("您确定要导入吗？")) {
				$("#fileUpload").submit();
			}
		}
	</script>

</body>
</html>